Kinetis SDK API Reference Manual  1.0.0-beta
Freescale Semiconductor, Inc.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
ENET HAL driver

The section describes the programming interface of the ENET HAL driver. More...

Data Structures

struct  enet_bd_struct_t
 Defines the buffer descriptor structure for the little-Endian system and endianness configurable IP. More...
 
struct  enet_config_ptp_timer_t
 Defines the configuration structure for the 1588 PTP timer. More...
 
struct  enet_config_tx_accelerator_t
 Defines the transmit accelerator configuration. More...
 
struct  enet_config_rx_accelerator_t
 Defines the receive accelerator configuration. More...
 
struct  enet_config_tx_fifo_t
 Defines the transmit FIFO configuration. More...
 
struct  enet_config_rx_fifo_t
 Defines the receive FIFO configuration. More...
 

Macros

#define SYSTEM_LITTLE_ENDIAN   (1)
 Defines the system endian type. More...
 
#define BSWAP_16(x)   (uint16_t)((uint16_t)(((uint16_t)(x) & (uint16_t)0xFF00) >> 0x8) | (uint16_t)(((uint16_t)(x) & (uint16_t)0xFF) << 0x8))
 Define macro to do the endianness swap.
 
#define BSWAP_32(x)   (uint32_t)((((uint32_t)(x) & 0x00FFU) << 24) | (((uint32_t)(x) & 0x00FF00U) << 8) | (((uint32_t)(x) & 0xFF0000U) >> 8) | (((uint32_t)(x) & 0xFF000000U) >> 24))
 
#define HTONS(n)   (n)
 
#define HTONL(n)   (n)
 
#define NTOHS(n)   (n)
 
#define NTOHL(n)   (n)
 

Typedefs

typedef uint8_t enetMacAddr [kEnetMacAddrLen]
 Defines the six-byte Mac address type. More...
 

Enumerations

enum  enet_status_t {
  kStatus_ENET_Success = 0,
  kStatus_ENET_InvalidInput,
  kStatus_ENET_InvalidDevice,
  kStatus_ENET_MemoryAllocateFail,
  kStatus_ENET_GetClockFreqFail,
  kStatus_ENET_Initialized,
  kStatus_ENET_Open,
  kStatus_ENET_Close,
  kStatus_ENET_Layer2QueueNull,
  kStatus_ENET_Layer2OverLarge,
  kStatus_ENET_Layer2BufferFull,
  kStatus_ENET_Layer2TypeError,
  kStatus_ENET_PtpringBufferFull,
  kStatus_ENET_PtpringBufferEmpty,
  kStatus_ENET_Miiuninitialized,
  kStatus_ENET_RxbdInvalid,
  kStatus_ENET_RxbdEmpty,
  kStatus_ENET_RxbdTrunc,
  kStatus_ENET_RxbdError,
  kStatus_ENET_RxBdFull,
  kStatus_ENET_SmallBdSize,
  kStatus_ENET_LargeBufferFull,
  kStatus_ENET_TxLarge,
  kStatus_ENET_TxbdFull,
  kStatus_ENET_TxbdNull,
  kStatus_ENET_TxBufferNull,
  kStatus_ENET_NoRxBufferLeft,
  kStatus_ENET_UnknownCommand,
  kStatus_ENET_TimeOut,
  kStatus_ENET_MulticastPointerNull,
  kStatus_ENET_NoMulticastAddr,
  kStatus_ENET_AlreadyAddedMulticast
}
 Defines the Status return codes. More...
 
enum  enet_rx_bd_control_status_t {
  kEnetRxBdEmpty = 0x8000,
  kEnetRxBdRxSoftOwner1 = 0x4000,
  kEnetRxBdWrap = 0x2000,
  kEnetRxBdRxSoftOwner2 = 0x1000,
  kEnetRxBdLast = 0x0800,
  kEnetRxBdMiss = 0x0100,
  kEnetRxBdBroadCast = 0x0080,
  kEnetRxBdMultiCast = 0x0040,
  kEnetRxBdLengthViolation = 0x0020,
  kEnetRxBdNoOctet = 0x0010,
  kEnetRxBdCrc = 0x0004,
  kEnetRxBdOverRun = 0x0002,
  kEnetRxBdTrunc = 0x0001
}
 Defines the control and status region of the receive buffer descriptor. More...
 
enum  enet_rx_bd_control_extend_t {
  kEnetRxBdIpv4 = 0x0001,
  kEnetRxBdIpv6 = 0x0002,
  kEnetRxBdVlan = 0x0004,
  kEnetRxBdProtocolChecksumErr = 0x0010,
  kEnetRxBdIpHeaderChecksumErr = 0x0020,
  kEnetRxBdIntrrupt = 0x0080,
  kEnetRxBdUnicast = 0x0100,
  kEnetRxBdCollision = 0x0200,
  kEnetRxBdPhyErr = 0x0400,
  kEnetRxBdMacErr = 0x8000
}
 Defines the control extended region of the receive buffer descriptor. More...
 
enum  enet_tx_bd_control_status_t {
  kEnetTxBdReady = 0x8000,
  kEnetTxBdTxSoftOwner1 = 0x4000,
  kEnetTxBdWrap = 0x2000,
  kEnetTxBdTxSoftOwner2 = 0x1000,
  kEnetTxBdLast = 0x0800,
  kEnetTxBdTransmitCrc = 0x0400
}
 Defines the control status of the transmit buffer descriptor. More...
 
enum  enet_tx_bd_control_extend_t {
  kEnetTxBdTxErr = 0x8000,
  kEnetTxBdTxUnderFlowErr = 0x2000,
  kEnetTxBdExcessCollisionErr = 0x1000,
  kEnetTxBdTxFrameErr = 0x0800,
  kEnetTxBdLatecollisionErr = 0x0400,
  kEnetTxBdOverFlowErr = 0x0200,
  kEnetTxTimestampErr = 0x0100
}
 Defines the control extended of the transmit buffer descriptor. More...
 
enum  enet_tx_bd_control_extend2_t {
  kEnetTxBdTxInterrupt = 0x4000,
  kEnetTxBdTimeStamp = 0x2000
}
 Defines the control extended2 of the transmit buffer descriptor. More...
 
enum  enet_constant_parameter_t {
  kEnetMacAddrLen = 6,
  kEnetHashValMask = 0x1f,
  kEnetRxBdCtlJudge1 = 0x0080,
  kEnetRxBdCtlJudge2 = 0x8000
}
 Defines the macro to the different ENET constant value. More...
 
enum  enet_config_rmii_t {
  kEnetCfgMii = 0,
  kEnetCfgRmii = 1
}
 Defines the RMII or MII mode for data interface between the MAC and the PHY. More...
 
enum  enet_config_speed_t {
  kEnetCfgSpeed100M = 0,
  kEnetCfgSpeed10M = 1
}
 Defines the 10 Mbps or 100 Mbps speed mode for the data transfer. More...
 
enum  enet_config_duplex_t {
  kEnetCfgHalfDuplex = 0,
  kEnetCfgFullDuplex = 1
}
 Defines the half or full duplex mode for the data transfer. More...
 
enum  enet_mii_operation_t {
  kEnetWriteNoCompliant = 0,
  kEnetWriteValidFrame = 1,
  kEnetReadValidFrame = 2,
  kEnetReadNoCompliant = 3
}
 Defines the write/read operation for the MII. More...
 
enum  enet_mdio_holdon_clkcycle_t {
  kEnetMdioHoldOneClkCycle = 0,
  kEnetMdioHoldTwoClkCycle = 1,
  kEnetMdioHoldThreeClkCycle = 2,
  kEnetMdioHoldFourClkCycle = 3,
  kEnetMdioHoldFiveClkCycle = 4,
  kEnetMdioHoldSixClkCycle = 5,
  kEnetMdioHoldSevenClkCycle = 6,
  kEnetMdioHoldEightClkCycle = 7
}
 Define holdon time on MDIO output. More...
 
enum  enet_special_address_filter_t {
  kEnetSpecialAddressInit = 0,
  kEnetSpecialAddressEnable = 1,
  kEnetSpecialAddressDisable = 2
}
 Defines the initialization, enables or disables the operation for a special address filter. More...
 
enum  enet_timer_channel_mode_t {
  kEnetChannelDisable = 0,
  kEnetChannelRisingCapture = 1,
  kEnetChannelFallingCapture = 2,
  kEnetChannelBothCapture = 3,
  kEnetChannelSoftCompare = 4,
  kEnetChannelToggleCompare = 5,
  kEnetChannelClearCompare = 6,
  kEnetChannelSetCompare = 7,
  kEnetChannelClearCompareSetOverflow = 10,
  kEnetChannelSetCompareClearOverflow = 11,
  kEnetChannelPulseLowonCompare = 14,
  kEnetChannelPulseHighonCompare = 15
}
 Defines the capture or compare mode for 1588 timer channels. More...
 
enum  enet_interrupt_request_t {
  kEnetBabrInterrupt = 0x40000000,
  kEnetBabtInterrupt = 0x20000000,
  kEnetGraInterrupt = 0x10000000,
  kEnetTxFrameInterrupt = 0x8000000,
  kEnetTxByteInterrupt = 0x4000000,
  kEnetRxFrameInterrupt = 0x2000000,
  kEnetRxByteInterrupt = 0x1000000,
  kEnetMiiInterrupt = 0x0800000,
  kEnetEBERInterrupt = 0x0400000,
  kEnetLcInterrupt = 0x0200000,
  kEnetRlInterrupt = 0x0100000,
  kEnetUnInterrupt = 0x0080000,
  kEnetPlrInterrupt = 0x0040000,
  kEnetWakeupInterrupt = 0x0020000,
  kEnetTsAvailInterrupt = 0x0010000,
  kEnetTsTimerInterrupt = 0x0008000,
  kEnetAllInterrupt = 0xFFFFFFFF
}
 Defines the RXFRAME/RXBYTE/TXFRAME/TXBYTE/MII/TSTIMER/TSAVAIL interrupt source for ENET. More...
 

Functions

static void enet_hal_reset_ethernet (uint32_t instance)
 Resets the ENET module. More...
 
static bool enet_hal_is_reset_completed (uint32_t instance)
 Gets the ENET status to check whether the reset has completed. More...
 
static void enet_hal_enable_stop (uint32_t instance, bool isEnabled)
 Enable or disable stop mode. More...
 
static void enet_hal_enable_sleep (uint32_t instance, bool isEnabled)
 Enable or disable sleep mode. More...
 
void enet_hal_set_mac_address (uint32_t instance, enetMacAddr hwAddr)
 Sets the Mac address. More...
 
void enet_hal_set_group_hashtable (uint32_t instance, uint32_t crcValue, enet_special_address_filter_t mode)
 Sets the hardware addressing filtering to a multicast group address. More...
 
void enet_hal_set_individual_hashtable (uint32_t instance, uint32_t crcValue, enet_special_address_filter_t mode)
 Sets the hardware addressing filtering to an individual address. More...
 
static void enet_hal_enable_payloadcheck (uint32_t instance, bool isEnabled)
 Enable/disable payload length check. More...
 
static void enet_hal_enable_txcrcforward (uint32_t instance, bool isEnabled)
 Enable/disable append CRC to transmitted frames. More...
 
static void enet_hal_enable_rxcrcforward (uint32_t instance, bool isEnabled)
 Enable/disable forward the CRC filed of the received frame. More...
 
static void enet_hal_enable_pauseforward (uint32_t instance, bool isEnabled)
 Enable/disable forward PAUSE frames. More...
 
static void enet_hal_enable_padremove (uint32_t instance, bool isEnabled)
 Enable/disable frame padding remove on receive. More...
 
static void enet_hal_enable_flowcontrol (uint32_t instance, bool isEnabled)
 Enable/disable flow control. More...
 
static void enet_hal_enable_broadcastreject (uint32_t instance, bool isEnabled)
 Enable/disable broadcast frame reject. More...
 
static void enet_hal_set_pauseduration (uint32_t instance, uint32_t pauseDuration)
 Sets PAUSE duration for a PAUSE frame. More...
 
static bool enet_hal_get_rxpause_status (uint32_t instance)
 Gets receive PAUSE frame status. More...
 
static void enet_hal_enable_txpause (uint32_t instance, bool isEnabled)
 Enables transmit frame control PAUSE. More...
 
void enet_hal_set_txpause (uint32_t instance, uint32_t pauseDuration)
 Sets transmit PAUSE frame. More...
 
static void enet_hal_set_txipg (uint32_t instance, uint32_t ipgValue)
 Sets the transmit inter-packet gap. More...
 
static void enet_hal_set_truncationlen (uint32_t instance, uint32_t length)
 Sets the receive frame truncation length. More...
 
static void enet_hal_set_rx_max_size (uint32_t instance, uint32_t maxBufferSize, uint32_t maxFrameSize)
 Sets the maximum receive buffer size and the maximum frame size. More...
 
void enet_hal_config_tx_fifo (uint32_t instance, enet_config_tx_fifo_t *thresholdCfg)
 Configures the ENET transmit FIFO. More...
 
void enet_hal_config_rx_fifo (uint32_t instance, enet_config_rx_fifo_t *thresholdCfg)
 Configures the ENET receive FIFO. More...
 
static void enet_hal_set_rxbd_address (uint32_t instance, uint32_t rxBdAddr)
 Sets the start address for ENET receive buffer descriptors. More...
 
static void enet_hal_set_txbd_address (uint32_t instance, uint32_t txBdAddr)
 Sets the start address for ENET transmit buffer descriptors. More...
 
void enet_hal_init_rxbds (void *rxBds, uint8_t *buffer, bool isLastBd)
 Initializes the receive buffer descriptors. More...
 
void enet_hal_init_txbds (void *txBds, bool isLastBd)
 Initializes the transmit buffer descriptors. More...
 
void enet_hal_update_rxbds (void *rxBds, uint8_t *data, bool isbufferUpdate)
 Updates the receive buffer descriptors. More...
 
void enet_hal_update_txbds (void *txBds, uint8_t *buffer, uint16_t length, bool isTxtsCfged)
 Updates the transmit buffer descriptors. More...
 
static void enet_hal_clear_txbds (void *curBd)
 Clears the context in the transmit buffer descriptors. More...
 
uint16_t enet_hal_get_rxbd_control (void *curBd)
 Gets the control and the status region of the receive buffer descriptors. More...
 
uint16_t enet_hal_get_txbd_control (void *curBd)
 Gets the control and the status region of the transmit buffer descriptors. More...
 
bool enet_hal_get_rxbd_control_extend (void *curBd, enet_rx_bd_control_extend_t controlRegion)
 Gets the extended control region of the receive buffer descriptors. More...
 
uint16_t enet_hal_get_txbd_control_extend (void *curBd)
 Gets the extended control region of the transmit buffer descriptors. More...
 
uint16_t enet_hal_get_bd_length (void *curBd)
 Gets the data length of the buffer descriptors. More...
 
uint8_t * enet_hal_get_bd_buffer (void *curBd)
 Gets the buffer address of the buffer descriptors. More...
 
uint32_t enet_hal_get_bd_timestamp (void *curBd)
 Gets the timestamp of the buffer descriptors. More...
 
static void enet_hal_active_rxbd (uint32_t instance)
 Activates the receive buffer descriptor. More...
 
static void enet_hal_active_txbd (uint32_t instance)
 Activates the transmit buffer descriptor. More...
 
void enet_hal_config_rmii (uint32_t instance, enet_config_rmii_t mode, enet_config_speed_t speed, enet_config_duplex_t duplex, bool isRxOnTxDisabled, bool isLoopEnabled)
 Configures the (R)MII of ENET. More...
 
static void enet_hal_config_mii (uint32_t instance, uint32_t miiSpeed, enet_mdio_holdon_clkcycle_t clkCycle, bool isPreambleDisabled)
 Configures the MII of ENET. More...
 
static bool enet_hal_is_mii_enabled (uint32_t instance)
 Gets the MII configuration status. More...
 
static uint32_t enet_hal_get_mii_data (uint32_t instance)
 Reads data from PHY. More...
 
void enet_hal_set_mii_command (uint32_t instance, uint32_t phyAddr, uint32_t phyReg, enet_mii_operation_t operation, uint32_t data)
 Sets the MII command. More...
 
void enet_hal_config_ethernet (uint32_t instance, bool isEnhanced, bool isEnabled)
 Enables/Disables the ENET module. More...
 
void enet_hal_config_interrupt (uint32_t instance, uint32_t source, bool isEnabled)
 Enables/Disables the ENET interrupt. More...
 
static void enet_hal_clear_interrupt (uint32_t instance, uint32_t source)
 Clears ENET interrupt events. More...
 
static bool enet_hal_get_interrupt_status (uint32_t instance, uint32_t source)
 Gets the ENET interrupt status. More...
 
static void enet_hal_config_promiscuous (uint32_t instance, bool isEnabled)
 
static void enet_hal_clear_mib (uint32_t instance, bool isEnabled)
 Enables/disables the clear MIB counter. More...
 
static void enet_hal_enable_mib (uint32_t instance, bool isEnabled)
 Sets the enable/disable of the MIB block. More...
 
static bool enet_hal_get_mib_status (uint32_t instance)
 Gets the MIB idle status. More...
 
void enet_hal_config_tx_accelerator (uint32_t instance, enet_config_tx_accelerator_t *txCfgPtr)
 Sets the transmit accelerator. More...
 
void enet_hal_config_rx_accelerator (uint32_t instance, enet_config_rx_accelerator_t *rxCfgPtr)
 Sets the receive accelerator. More...
 
void enet_hal_init_ptp_timer (uint32_t instance, enet_config_ptp_timer_t *ptpCfgPtr)
 Initializes the 1588 timer. More...
 
static void enet_hal_enable_ptp_timer (uint32_t instance, uint32_t isEnabled)
 Enables or disables the 1588 timer. More...
 
static void enet_hal_restart_ptp_timer (uint32_t instance)
 Restarts the 1588 timer. More...
 
static void enet_hal_adjust_ptp_timer (uint32_t instance, uint32_t increaseCorrection, uint32_t periodCorrection)
 Adjusts the 1588 timer. More...
 
static void enet_hal_init_timer_channel (uint32_t instance, uint32_t channel, enet_timer_channel_mode_t mode)
 Initializes the 1588 timer channel. More...
 
static void enet_hal_set_timer_channel_compare (uint32_t instance, uint32_t channel, uint32_t compareValue)
 Sets the compare value for the 1588 timer channel. More...
 
static bool enet_hal_get_timer_channel_status (uint32_t instance, uint32_t channel)
 Gets the 1588 timer channel status. More...
 
static void enet_hal_clear_timer_channel_flag (uint32_t instance, uint32_t channel)
 Clears the 1588 timer channel flag. More...
 
static void enet_hal_set_timer_capture (uint32_t instance)
 Sets the capture command to the 1588 timer. More...
 
static void enet_hal_set_current_time (uint32_t instance, uint32_t nanSecond)
 Sets the 1588 timer. More...
 
static uint32_t enet_hal_get_current_time (uint32_t instance)
 Gets the time from the 1588 timer. More...
 
static uint32_t enet_hal_get_tx_timestamp (uint32_t instance)
 Gets the transmit timestamp. More...
 
bool enet_hal_get_txbd_timestamp_flag (void *curBd)
 Gets the transmit buffer descriptor timestamp flag. More...
 
static uint32_t enet_hal_get_bd_size (void)
 Gets the buffer descriptor timestamp. More...
 

Data Structure Documentation

struct enet_bd_struct_t

Data Fields

uint16_t length
 Buffer descriptor data length.
 
uint16_t control
 Buffer descriptor control.
 
uint8_t * buffer
 Data buffer pointer.
 
uint16_t controlExtend0
 Extend buffer descriptor control0.
 
uint16_t controlExtend1
 Extend buffer descriptor control1.
 
uint16_t payloadCheckSum
 Internal payload checksum.
 
uint8_t headerLength
 Header length.
 
uint8_t protocalTyte
 Protocol type.
 
uint16_t reserved0
 
uint16_t controlExtend2
 Extend buffer descriptor control2.
 
uint32_t timestamp
 Timestamp.
 
uint16_t reserved1
 
uint16_t reserved2
 
uint16_t reserved3
 
uint16_t reserved4
 
struct enet_config_ptp_timer_t

Data Fields

bool isSlaveEnabled
 Master or slave PTP timer.
 
uint32_t clockIncease
 Timer increase value each clock period.
 
uint32_t period
 Timer period for generate interrupt event.
 
struct enet_config_tx_accelerator_t

Data Fields

bool isIpCheckEnabled
 Insert IP header checksum.
 
bool isProtocolCheckEnabled
 Insert protocol checksum.
 
bool isShift16Enabled
 Tx FIFO shift-16.
 
struct enet_config_rx_accelerator_t

Data Fields

bool isIpcheckEnabled
 Discard with wrong IP header checksum.
 
bool isProtocolCheckEnabled
 Discard with wrong protocol checksum.
 
bool isMacCheckEnabled
 Discard with Mac layer errors.
 
bool isPadRemoveEnabled
 Padding removal for short IP frames.
 
bool isShift16Enabled
 Rx FIFO shift-16.
 
struct enet_config_tx_fifo_t

Data Fields

bool isStoreForwardEnabled
 Transmit FIFO store and forward.
 
uint8_t txFifoWrite
 Transmit FIFO write.
 
uint8_t txEmpty
 Transmit FIFO section empty threshold.
 
uint8_t txAlmostEmpty
 Transmit FIFO section almost empty threshold.
 
uint8_t txAlmostFull
 Transmit FIFO section almost full threshold.
 
struct enet_config_rx_fifo_t

Data Fields

uint8_t rxFull
 Receive FIFO section full threshold.
 
uint8_t rxAlmostFull
 Receive FIFO section almost full threshold.
 
uint8_t rxEmpty
 Receive FIFO section empty threshold.
 
uint8_t rxAlmostEmpty
 Receive FIFO section almost empty threshold.
 

Macro Definition Documentation

#define SYSTEM_LITTLE_ENDIAN   (1)

Typedef Documentation

typedef uint8_t enetMacAddr[kEnetMacAddrLen]

Enumeration Type Documentation

Enumerator
kStatus_ENET_InvalidInput 

Invalid ENET input parameter.

kStatus_ENET_InvalidDevice 

Invalid ENET device.

kStatus_ENET_MemoryAllocateFail 

Memory allocate failure.

kStatus_ENET_GetClockFreqFail 

Get clock frequency failure.

kStatus_ENET_Initialized 

ENET device already initialized.

kStatus_ENET_Open 

Open ENET device.

kStatus_ENET_Close 

Close ENET device.

kStatus_ENET_Layer2QueueNull 

NULL L2 PTP buffer queue pointer.

kStatus_ENET_Layer2OverLarge 

Layer2 packet length over large.

kStatus_ENET_Layer2BufferFull 

Layer2 packet buffer full.

kStatus_ENET_Layer2TypeError 

Layer2 packet error type.

kStatus_ENET_PtpringBufferFull 

PTP ring buffer full.

kStatus_ENET_PtpringBufferEmpty 

PTP ring buffer empty.

kStatus_ENET_Miiuninitialized 

MII uninitialized.

kStatus_ENET_RxbdInvalid 

Receive buffer descriptor invalid.

kStatus_ENET_RxbdEmpty 

Receive buffer descriptor empty.

kStatus_ENET_RxbdTrunc 

Receive buffer descriptor truncate.

kStatus_ENET_RxbdError 

Receive buffer descriptor error.

kStatus_ENET_RxBdFull 

Receive buffer descriptor full.

kStatus_ENET_SmallBdSize 

Small receive buffer size.

kStatus_ENET_LargeBufferFull 

Receive large buffer full.

kStatus_ENET_TxLarge 

Transmit large packet.

kStatus_ENET_TxbdFull 

Transmit buffer descriptor full.

kStatus_ENET_TxbdNull 

Transmit buffer descriptor Null.

kStatus_ENET_TxBufferNull 

Transmit data buffer Null.

kStatus_ENET_NoRxBufferLeft 

No more receive buffer left.

kStatus_ENET_UnknownCommand 

Invalid ENET PTP IOCTL command.

kStatus_ENET_TimeOut 

ENET Timeout.

kStatus_ENET_MulticastPointerNull 

Null multicast group pointer.

kStatus_ENET_NoMulticastAddr 

No multicast group address.

kStatus_ENET_AlreadyAddedMulticast 

Have Already added to multicast group.

Enumerator
kEnetRxBdEmpty 

Empty bit.

kEnetRxBdRxSoftOwner1 

Receive software owner.

kEnetRxBdWrap 

Update buffer descriptor.

kEnetRxBdRxSoftOwner2 

Receive software owner.

kEnetRxBdLast 

Last BD in the frame.

kEnetRxBdMiss 

Receive for promiscuous mode.

kEnetRxBdBroadCast 

Broadcast.

kEnetRxBdMultiCast 

Multicast.

kEnetRxBdLengthViolation 

Receive length violation.

kEnetRxBdNoOctet 

Receive non-octet aligned frame.

kEnetRxBdCrc 

Receive CRC error.

kEnetRxBdOverRun 

Receive FIFO overrun.

kEnetRxBdTrunc 

Frame is truncated.

Enumerator
kEnetRxBdIpv4 

Ipv4 frame.

kEnetRxBdIpv6 

Ipv6 frame.

kEnetRxBdVlan 

VLAN.

kEnetRxBdProtocolChecksumErr 

Protocol checksum error.

kEnetRxBdIpHeaderChecksumErr 

IP header checksum error.

kEnetRxBdIntrrupt 

BD interrupt.

kEnetRxBdUnicast 

Unicast frame.

kEnetRxBdCollision 

BD collision.

kEnetRxBdPhyErr 

PHY error.

kEnetRxBdMacErr 

Mac error.

Enumerator
kEnetTxBdReady 

Ready bit.

kEnetTxBdTxSoftOwner1 

Transmit software owner.

kEnetTxBdWrap 

Wrap buffer descriptor.

kEnetTxBdTxSoftOwner2 

Transmit software owner.

kEnetTxBdLast 

Last BD in the frame.

kEnetTxBdTransmitCrc 

Receive for transmit CRC.

Enumerator
kEnetTxBdTxErr 

Transmit error.

kEnetTxBdTxUnderFlowErr 

Underflow error.

kEnetTxBdExcessCollisionErr 

Excess collision error.

kEnetTxBdTxFrameErr 

Frame error.

kEnetTxBdLatecollisionErr 

Late collision error.

kEnetTxBdOverFlowErr 

Overflow error.

kEnetTxTimestampErr 

Timestamp error.

Enumerator
kEnetTxBdTxInterrupt 

Transmit interrupt.

kEnetTxBdTimeStamp 

Transmit timestamp flag.

Enumerator
kEnetMacAddrLen 

ENET mac address length.

kEnetHashValMask 

ENET hash value mask.

kEnetRxBdCtlJudge1 

ENET receive buffer descriptor control judge value1.

kEnetRxBdCtlJudge2 

ENET receive buffer descriptor control judge value2.

Enumerator
kEnetCfgMii 

MII mode for data interface.

kEnetCfgRmii 

RMII mode for data interface.

Enumerator
kEnetCfgSpeed100M 

Speed 100 M mode.

kEnetCfgSpeed10M 

Speed 10 M mode.

Enumerator
kEnetCfgHalfDuplex 

Half duplex mode.

kEnetCfgFullDuplex 

Full duplex mode.

Enumerator
kEnetWriteNoCompliant 

Write frame operation, but not MII compliant.

kEnetWriteValidFrame 

Write frame operation for a valid MII management frame.

kEnetReadValidFrame 

Read frame operation for a valid MII management frame.

kEnetReadNoCompliant 

Read frame operation, but not MII compliant.

Enumerator
kEnetMdioHoldOneClkCycle 

MDIO output hold on one clock cycle.

kEnetMdioHoldTwoClkCycle 

MDIO output hold on two clock cycles.

kEnetMdioHoldThreeClkCycle 

MDIO output hold on three clock cycles.

kEnetMdioHoldFourClkCycle 

MDIO output hold on four clock cycles.

kEnetMdioHoldFiveClkCycle 

MDIO output hold on five clock cycles.

kEnetMdioHoldSixClkCycle 

MDIO output hold on six clock cycles.

kEnetMdioHoldSevenClkCycle 

MDIO output hold seven two clock cycles.

kEnetMdioHoldEightClkCycle 

MDIO output hold on eight clock cycles.

Enumerator
kEnetSpecialAddressInit 

Initializes the special address filter.

kEnetSpecialAddressEnable 

Enables the special address filter.

kEnetSpecialAddressDisable 

Disables the special address filter.

Enumerator
kEnetChannelDisable 

Disable timer channel.

kEnetChannelRisingCapture 

Input capture on rising edge.

kEnetChannelFallingCapture 

Input capture on falling edge.

kEnetChannelBothCapture 

Input capture on both edges.

kEnetChannelSoftCompare 

Output compare software only.

kEnetChannelToggleCompare 

Toggle output on compare.

kEnetChannelClearCompare 

Clear output on compare.

kEnetChannelSetCompare 

Set output on compare.

kEnetChannelClearCompareSetOverflow 

Clear output on compare, set output on overflow.

kEnetChannelSetCompareClearOverflow 

Set output on compare, clear output on overflow.

kEnetChannelPulseLowonCompare 

Pulse output low on compare for one 1588 clock cycle.

kEnetChannelPulseHighonCompare 

Pulse output high on compare for one 1588 clock cycle.

Enumerator
kEnetBabrInterrupt 

BABR interrupt source.

kEnetBabtInterrupt 

BABT interrupt source.

kEnetGraInterrupt 

GRA interrupt source.

kEnetTxFrameInterrupt 

TXFRAME interrupt source.

kEnetTxByteInterrupt 

TXBYTE interrupt source.

kEnetRxFrameInterrupt 

RXFRAME interrupt source.

kEnetRxByteInterrupt 

RXBYTE interrupt source.

kEnetMiiInterrupt 

MII interrupt source.

kEnetEBERInterrupt 

EBERR interrupt source.

kEnetLcInterrupt 

LC interrupt source.

kEnetRlInterrupt 

RL interrupt source.

kEnetUnInterrupt 

UN interrupt source.

kEnetPlrInterrupt 

PLR interrupt source.

kEnetWakeupInterrupt 

WAKEUP interrupt source.

kEnetTsAvailInterrupt 

TS AVAIL interrupt source.

kEnetTsTimerInterrupt 

TS WRAP interrupt source.

kEnetAllInterrupt 

All interrupt.

Function Documentation

static void enet_hal_reset_ethernet ( uint32_t  instance)
inlinestatic
Parameters
instanceThe ENET instance number
static bool enet_hal_is_reset_completed ( uint32_t  instance)
inlinestatic
Parameters
instanceThe ENET instance number
Returns
Current status of the reset operation
  • true if ENET reset completed.
  • false if ENET reset has not completed.
static void enet_hal_enable_stop ( uint32_t  instance,
bool  isEnabled 
)
inlinestatic

Enable stop mode will control device behavior in doze mode. In doze mode, if this filed is set then all clock of the enet assemably are disabled, except the RMII/MII clock.

Parameters
instanceThe ENET instance number.
isEnabledThe switch to enable/disable stop mode.
  • true to enabale the stop mode.
  • false to disable the stop mode.
static void enet_hal_enable_sleep ( uint32_t  instance,
bool  isEnabled 
)
inlinestatic

Enable sleep mode will disable normal operating mode. When enable the sleep mode, the magic packet detection is also enabled so that a remote agent can wakeup the node.

Parameters
instanceThe ENET instance number.
isEnabledThe switch to enable/disable the sleep mode.
  • true to enabale the sleep mode.
  • false to disable the sleep mode.
void enet_hal_set_mac_address ( uint32_t  instance,
enetMacAddr  hwAddr 
)

This interface sets the six-byte Mac address of the ENET interface.

Parameters
instanceThe ENET instance number
hwAddrThe mac address pointer store for six bytes Mac address
void enet_hal_set_group_hashtable ( uint32_t  instance,
uint32_t  crcValue,
enet_special_address_filter_t  mode 
)

This interface is used to add the ENET device to a multicast group address. After joining the group, Mac receives all frames with the group Mac address.

Parameters
instanceThe ENET instance number
crcValueThe CRC value of the special address
modeThe operation for init/enable/disable the specified hardware address
void enet_hal_set_individual_hashtable ( uint32_t  instance,
uint32_t  crcValue,
enet_special_address_filter_t  mode 
)

This interface is used to add an individual address to the hardware address filter. Mac receives all frames with the individual address as a destination address.

Parameters
instanceThe ENET instance number
crcValueThe CRC value of the special address
modeThe operation for init/enable/disable the specified hardware address
static void enet_hal_enable_payloadcheck ( uint32_t  instance,
bool  isEnabled 
)
inlinestatic

If the length/type is less than 0x600,When enable payload length check the core checks the fame's payload length. If the length/type is greater than or equal to 0x600. The MAC interprets the field as a type and no payload length check is performanced.

Parameters
instanceThe ENET instance number
isEnabledThe switch to enable/disable payload length check
  • True to enabale payload length check.
  • False to disable payload legnth check.
static void enet_hal_enable_txcrcforward ( uint32_t  instance,
bool  isEnabled 
)
inlinestatic

If transmit CRC forward is enabled, the transmit buffer descriptor controls whether the frame has a CRC from the application. If transmit CRC forward is disabled, transmitter does not append any CRC to transmitted frames.

Parameters
instanceThe ENET instance number
isEnabledThe switch to enable/disable transmit the receive CRC
  • True the transmitter control CRC through transmit buffer descriptor.
  • False the transmitter does not append any CRC to transmitted frames.
static void enet_hal_enable_rxcrcforward ( uint32_t  instance,
bool  isEnabled 
)
inlinestatic

This is used to deceide whether the CRC field of received frame is transmitted or stripped. Enable this feature to strip CRC field from the frame. If padding remove is enabled, this feature will be ignored and the CRC field is checked and always terminated and removed.

Parameters
instanceThe ENET instance number
isEnabledThe switch to enable/disable transmit the receive CRC
  • True to transmit the received CRC.
  • False to strip the received CRC.
static void enet_hal_enable_pauseforward ( uint32_t  instance,
bool  isEnabled 
)
inlinestatic

This is used to deceide whether PAUSE frames is forwarded or discarded.

Parameters
instanceThe ENET instance number
isEnabledThe switch to enable/disable forward PAUSE frames
  • True to forward PAUSE frames.
  • False to terminate and discard PAUSE frames.
static void enet_hal_enable_padremove ( uint32_t  instance,
bool  isEnabled 
)
inlinestatic

Enable frame padding remove will remove the padding from the received frames.

Parameters
instanceThe ENET instance number
isEnabledThe switch to enable/disable remove padding
  • True to remove padding from frames.
  • False to disable padding remove.
static void enet_hal_enable_flowcontrol ( uint32_t  instance,
bool  isEnabled 
)
inlinestatic

If flow control is enabled, the receive detects PAUSE frames. Upon PAUSE frame detection, the transmitter stops transmitting data frames for a given duration.

Parameters
instanceThe ENET instance number
isEnabledThe switch to enable/disable flow control
  • True to enable the flow control.
  • False to disable the flow control.
static void enet_hal_enable_broadcastreject ( uint32_t  instance,
bool  isEnabled 
)
inlinestatic

If broadcast frame reject is enabled, frames with destination address equal to 0xffff_ffff_ffff are rejected unless the promiscuous mode is open.

Parameters
instanceThe ENET instance number
isEnabledThe switch to enable/disable reject broadcast frames
  • True to reject broadcast frames.
  • False to accept broadcast frames.
static void enet_hal_set_pauseduration ( uint32_t  instance,
uint32_t  pauseDuration 
)
inlinestatic

This function is used to set the pause duraion used in transmission of a PAUSE frame. When another node detects a PAUSE frame, that node pauses transmission for the pause duration.

Parameters
instanceThe ENET instance number
pauseDurationThe PAUSE duration for the transmitted PAUSE frame the maximum pause duration is 0xFFFF.
static bool enet_hal_get_rxpause_status ( uint32_t  instance)
inlinestatic

This function is used to get the received PAUSE frame status.

Parameters
instanceThe ENET instance number
Returns
The status of the received flow control frames true if the flow control pause frame is received. false if there is no flow control frame received or the pause duration is complete.
static void enet_hal_enable_txpause ( uint32_t  instance,
bool  isEnabled 
)
inlinestatic

This function enables pauses frame transmission. When this is set, with transmission of data frames stopped, the MAC transmits a MAC control PAUSE frame. NEXT, the MAC clear the and resumes transmitting data frames.

Parameters
instanceThe ENET instance number
isEnabledThe switch to enable/disable PAUSE control frame transmission
  • True enable PAUSE control frame transmission.
  • Flase disable PAUSE control frame transmission.
void enet_hal_set_txpause ( uint32_t  instance,
uint32_t  pauseDuration 
)

This function Sets ENET transmit controller with pause duration. And set the transmit control to do PAUSE frame transmission This should be called when a PAUSE frame is dynamically wanted.

Parameters
instanceThe ENET instance number
static void enet_hal_set_txipg ( uint32_t  instance,
uint32_t  ipgValue 
)
inlinestatic

This function indicates the IPG, in bytes, between transmitted frames. Valid values range from 8 to 27. If value is less than 8, the IPG is 8. If value is greater than 27, the IPG is 27.

Parameters
instanceThe ENET instance number
ipgValueThe IPG for transmitted frames The default value is 12, the maximum value set to ipg is 0x1F.
static void enet_hal_set_truncationlen ( uint32_t  instance,
uint32_t  length 
)
inlinestatic

This function indicates the value a receive frame is truncated, if it is greater than this value. The frame truncation length must be greater than or equal to the receive maximum frame length.

Parameters
instanceThe ENET instance number
lengthThe truncation length. The maximum value is 0x3FFF The default truncation length is 2047(0x7FF).
static void enet_hal_set_rx_max_size ( uint32_t  instance,
uint32_t  maxBufferSize,
uint32_t  maxFrameSize 
)
inlinestatic
Parameters
instanceThe ENET instance number
maxBufferSizeThe maximum receive buffer size, which should not be smaller than 256 It should be evenly divisible by 16 and the maximum receive size should not be larger than 0x3ff0.
maxFrameSizeThe maximum receive frame size, the reset value is 1518 or 1522 if the VLAN tags are supported. The length is measured starting at DA and including the CRC.
void enet_hal_config_tx_fifo ( uint32_t  instance,
enet_config_tx_fifo_t thresholdCfg 
)
Parameters
instanceThe ENET instance number
thresholdCfgThe FIFO threshold configuration
void enet_hal_config_rx_fifo ( uint32_t  instance,
enet_config_rx_fifo_t thresholdCfg 
)
Parameters
instanceThe ENET instance number
thresholdCfgThe FIFO threshold configuration
static void enet_hal_set_rxbd_address ( uint32_t  instance,
uint32_t  rxBdAddr 
)
inlinestatic

This interface provides the beginning of the receive and receive buffer descriptor queue in the external memory. The txbdAddr is recommended to be 128-bit aligned, must be evenly divisible by 16.

Parameters
instanceThe ENET instance number
rxBdAddrThe start address of receive buffer descriptors
static void enet_hal_set_txbd_address ( uint32_t  instance,
uint32_t  txBdAddr 
)
inlinestatic

This interface provides the beginning of the receive and transmit buffer descriptor queue in the external memory. The txbdAddr is recommended to be 128-bit aligned, must be evenly divisible by 16.

Parameters
instanceThe ENET instance number
txBdAddrThe start address of transmit buffer descriptors
void enet_hal_init_rxbds ( void *  rxBds,
uint8_t *  buffer,
bool  isLastBd 
)

To make sure the uDMA will do the right data transfer after you activate with wrap flag and all the buffer descriptors should be initialized with an empty bit.

Parameters
rxBdsThe current receive buffer descriptor
bufferThe data buffer on buffer descriptor
isLastBdThe flag to indicate the last receive buffer descriptor
void enet_hal_init_txbds ( void *  txBds,
bool  isLastBd 
)

To make sure the uDMA will do the right data transfer after you active with wrap flag.

Parameters
txBdsThe current transmit buffer descriptor.
isLastBdThe last transmit buffer descriptor flag.

Ensures that the uDMA transfer data correctly after the user activates with the wrap flag.

Parameters
txBdsThe current transmit buffer descriptor
isLastBdThe last transmit buffer descriptor flag
void enet_hal_update_rxbds ( void *  rxBds,
uint8_t *  data,
bool  isbufferUpdate 
)

This interface mainly clears the status region and updates the received buffer descriptor to ensure that the BD is correctly used.

Parameters
rxBdsThe current receive buffer descriptor
dataThe data buffer address
isbufferUpdateThe data buffer update flag. When you want to update the data buffer of the buffer descriptor ensure that this flag is set.
void enet_hal_update_txbds ( void *  txBds,
uint8_t *  buffer,
uint16_t  length,
bool  isTxtsCfged 
)

This interface mainly clears the status region and updates the transmit buffer descriptor to ensure tat this BD is correctly used again. You should set the isTxtsCfged when the transmit timestamp feature is required.

Parameters
txBdsThe current transmit buffer descriptor
bufferThe data buffer on buffer descriptor
lengthThe data length on buffer descriptor
isTxtsCfgedThe timestamp configure flag. The timestamp is added to the transmit buffer descriptor when this flag is set.
static void enet_hal_clear_txbds ( void *  curBd)
inlinestatic

Clears the data, length, control, and status region of the transmit buffer descriptor.

Parameters
curBdThe current buffer descriptor
uint16_t enet_hal_get_rxbd_control ( void *  curBd)

This interface can get the whole control and status region of the receive buffer descriptor. The enet_rx_bd_control_status_t enum type definition should be used if you want to get each status bit of the control and status region.

Parameters
curBdThe current receive buffer descriptor
Returns
The control and status data on buffer descriptors
uint16_t enet_hal_get_txbd_control ( void *  curBd)

This interface can get the whole control and status region of the transmit buffer descriptor. The enet_tx_bd_control_status_t enum type definition should be used if you want to get each status bit of the control and status region.

Parameters
curBdThe current transmit buffer descriptor
Returns
The extended control region of transmit buffer descriptor
bool enet_hal_get_rxbd_control_extend ( void *  curBd,
enet_rx_bd_control_extend_t  controlRegion 
)

This interface can get the whole control and status region of the receive buffer descriptor. The enet_rx_bd_control_extend_t enum type definition should be used if you want to get each status bit of the control and status region.

Parameters
curBdThe current receive buffer descriptor
controlRegionThe different control region
Returns
The extended control region data of receive buffer descriptor
  • true when the control region is set
  • false when the control region is not set
uint16_t enet_hal_get_txbd_control_extend ( void *  curBd)

This interface can get the whole control and status region of the transmit buffer descriptor. The enet_tx_bd_control_extend_t enum type definition should be used if you want to get each status bit of the control and status region.

Parameters
curBdThe current transmit buffer descriptor
Returns
The extended control data
uint16_t enet_hal_get_bd_length ( void *  curBd)
Parameters
curBdThe current buffer descriptor
Returns
The data length of the buffer descriptor
uint8_t* enet_hal_get_bd_buffer ( void *  curBd)
Parameters
curBdThe current buffer descriptor
Returns
The buffer address of the buffer descriptor
uint32_t enet_hal_get_bd_timestamp ( void *  curBd)
Parameters
curBdThe current buffer descriptor
Returns
The time stamp of the frame in the buffer descriptor. Notice that the frame timestamp is only set in the last buffer descriptor of the frame.
static void enet_hal_active_rxbd ( uint32_t  instance)
inlinestatic

The buffer descriptor activation should be done after the ENET module is enabled. Otherwise, the activation fails.

Parameters
instanceThe ENET instance number
static void enet_hal_active_txbd ( uint32_t  instance)
inlinestatic

The buffer descriptor activation should be done after the ENET module is enabled. Otherwise, the activation fails.

Parameters
instanceThe ENET instance number
void enet_hal_config_rmii ( uint32_t  instance,
enet_config_rmii_t  mode,
enet_config_speed_t  speed,
enet_config_duplex_t  duplex,
bool  isRxOnTxDisabled,
bool  isLoopEnabled 
)
Parameters
instanceThe ENET instance number
modeThe RMII or MII mode
speedThe speed of RMII
duplexThe full or half duplex mode
isRxOnTxDisabledThe Receive on transmit disable flag
isLoopEnabledThe loop enable flag
static void enet_hal_config_mii ( uint32_t  instance,
uint32_t  miiSpeed,
enet_mdio_holdon_clkcycle_t  clkCycle,
bool  isPreambleDisabled 
)
inlinestatic

Sets the MII interface between Mac and PHY. The miiSpeed is a value that controls the frequency of the MDC, relative to the internal module clock(InterClockSrc). A value of zero in this parameter turns the MDC off and leaves it in the low voltage state. Any non-zero value results in the MDC frequency MDC = InterClockSrc/((miiSpeed + 1)*2). So miiSpeed = InterClockSrc/(2*MDC) - 1. The Maximum MDC clock is 2.5MHZ(maximum). We should round up and plus one to simlplify: miiSpeed = InterClockSrc/(2*2.5MHZ).

Parameters
instanceThe ENET instance number
miiSpeedThe MII speed and it is ranged from 0~0x3F
timeThe holdon clock cycles for MDIO output
isPreambleDisabledThe preamble disabled flag
static bool enet_hal_is_mii_enabled ( uint32_t  instance)
inlinestatic

This interface is usually called to check the MII interface before the Mac writes or reads the PHY registers.

Parameters
instanceThe ENET instance number
Returns
The MII configuration status
  • true if the MII has been configured.
  • false if the MII has not been configured.
static uint32_t enet_hal_get_mii_data ( uint32_t  instance)
inlinestatic
Parameters
instanceThe ENET instance number
Returns
The data read from PHY
void enet_hal_set_mii_command ( uint32_t  instance,
uint32_t  phyAddr,
uint32_t  phyReg,
enet_mii_operation_t  operation,
uint32_t  data 
)
Parameters
instanceThe ENET instance number
phyAddrThe PHY address
phyRegThe PHY register
operationThe read or write operation
dataThe data written to PHY
void enet_hal_config_ethernet ( uint32_t  instance,
bool  isEnhanced,
bool  isEnabled 
)
Parameters
instanceThe ENET instance number
isEnhancedThe enhanced 1588 feature switch
isEnabledThe ENET module enable switch
void enet_hal_config_interrupt ( uint32_t  instance,
uint32_t  source,
bool  isEnabled 
)
Parameters
instanceThe ENET instance number
sourceThe interrupt sources. enet_interrupt_request_t enum types is recommended as the interrupt source.
isEnabledThe interrupt enable switch
static void enet_hal_clear_interrupt ( uint32_t  instance,
uint32_t  source 
)
inlinestatic
Parameters
instanceThe ENET instance number
sourceThe interrupt source to be cleared. enet_interrupt_request_t enum types is recommended as the interrupt source.
static bool enet_hal_get_interrupt_status ( uint32_t  instance,
uint32_t  source 
)
inlinestatic
Parameters
instanceThe ENET instance number
sourceThe interrupt sources. enet_interrupt_request_t enum types is recommended as the interrupt source.
Returns
The event status of the interrupt source
  • true if the interrupt event happened.
  • false if the interrupt event has not happened.
static void enet_hal_clear_mib ( uint32_t  instance,
bool  isEnabled 
)
inlinestatic
Parameters
instanceThe ENET instance number
isEnabledThe enable switch
static void enet_hal_enable_mib ( uint32_t  instance,
bool  isEnabled 
)
inlinestatic
Parameters
instanceThe ENET instance number
isEnabledThe enable flag
  • True to enabale MIB block.
  • False to disable MIB block.
static bool enet_hal_get_mib_status ( uint32_t  instance)
inlinestatic
Parameters
instanceThe ENET instance number
Returns
true if in MIB idle and MIB is not updating else false.
void enet_hal_config_tx_accelerator ( uint32_t  instance,
enet_config_tx_accelerator_t txCfgPtr 
)
Parameters
instanceThe ENET instance number
txCfgPtrThe transmit accelerator configuration
void enet_hal_config_rx_accelerator ( uint32_t  instance,
enet_config_rx_accelerator_t rxCfgPtr 
)
Parameters
instanceThe ENET instance number
rxCfgPtrThe receive accelerator configuration
void enet_hal_init_ptp_timer ( uint32_t  instance,
enet_config_ptp_timer_t ptpCfgPtr 
)

This interface initializes the 1588 context structure. Initialize 1588 parameters according to the user configuration structure.

Parameters
instanceThe ENET instance number
ptpCfgThe 1588 timer configuration
static void enet_hal_enable_ptp_timer ( uint32_t  instance,
uint32_t  isEnabled 
)
inlinestatic

Enable the PTP timer will starts the timer. Disable the timer will stop timer at the current value.

Parameters
instanceThe ENET instance number.
isEnabledThe 1588 timer Enable switch
  • True enbaled the 1588 PTP timer.
  • False disable or stop the 1588 PTP timer.
static void enet_hal_restart_ptp_timer ( uint32_t  instance)
inlinestatic

Restarting the PTP timer clears all PTP-timer counters to zero.

Parameters
instanceThe ENET instance number
static void enet_hal_adjust_ptp_timer ( uint32_t  instance,
uint32_t  increaseCorrection,
uint32_t  periodCorrection 
)
inlinestatic

Adjust the 1588 timer according to the increase and correction period of the configured correction.

Parameters
instanceThe ENET instance number
inceaseCorrectionThe increase correction for 1588 timer
periodCorrectionThe period correction for 1588 timer
static void enet_hal_init_timer_channel ( uint32_t  instance,
uint32_t  channel,
enet_timer_channel_mode_t  mode 
)
inlinestatic
Parameters
instanceThe ENET instance number channel The 1588 timer channel number
modeCompare or capture mode for the 1588 timer channel
static void enet_hal_set_timer_channel_compare ( uint32_t  instance,
uint32_t  channel,
uint32_t  compareValue 
)
inlinestatic
Parameters
instanceThe ENET instance number channel The 1588 timer channel number
compareValueCompare value for 1588 timer channel
static bool enet_hal_get_timer_channel_status ( uint32_t  instance,
uint32_t  channel 
)
inlinestatic
Parameters
instanceThe ENET instance number
channelThe 1588 timer channel number
Returns
Compare or capture operation status
  • True if the compare or capture has occurred.
  • False if the compare or capture has not occurred.
static void enet_hal_clear_timer_channel_flag ( uint32_t  instance,
uint32_t  channel 
)
inlinestatic
Parameters
instanceThe ENET instance number
channelThe 1588 timer channel number
static void enet_hal_set_timer_capture ( uint32_t  instance)
inlinestatic

This is used before reading the current time register. After set timer capture, please wait for about 1us before read the captured timer.

Parameters
instanceThe ENET instance number
static void enet_hal_set_current_time ( uint32_t  instance,
uint32_t  nanSecond 
)
inlinestatic
Parameters
instanceThe ENET instance number
nanSecondThe nanosecond set to 1588 timer
static uint32_t enet_hal_get_current_time ( uint32_t  instance)
inlinestatic
Parameters
instanceThe ENET instance number
Returns
the current time from 1588 timer
static uint32_t enet_hal_get_tx_timestamp ( uint32_t  instance)
inlinestatic
Parameters
instanceThe ENET instance number
Returns
The timestamp of the last transmitted frame
bool enet_hal_get_txbd_timestamp_flag ( void *  curBd)
Parameters
curBdThe ENET transmit buffer descriptor
Returns
true if timestamp region is set else false.
static uint32_t enet_hal_get_bd_size ( void  )
inlinestatic
Parameters
null
Returns
The the size of the buffer descriptor